package org.yh.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.yh.service.ClusterService;
import org.yh.service.MasterService;

@RestController
@RequestMapping("user")
public class UserController {

	@Autowired
	MasterService masterService;

	@Autowired
	ClusterService clusterService;

	@RequestMapping("master/{name}/{age}/{sex}")
	public Integer addUser(@PathVariable String name, @PathVariable Integer age, @PathVariable String sex) {
		return masterService.addUser(name, age, sex);
	}

	@RequestMapping("cluster")
	public Integer addUser2(@RequestParam("name") String name, @RequestParam("age") Integer age,
			@RequestParam("sex") String sex) {
		return clusterService.addUser(name, age, sex);
	}
}
